from ise_api_0_login_info import username, password, url_prefix, headers
import requests
from requests.auth import HTTPBasicAuth
import urllib3
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)

get_by_id_url = 'config/identitygroup/{0}'
get_by_name_url = 'config/identitygroup/name/{0}'


def get_group_detail_by_id(group_id):
    r = requests.get(url_prefix + get_by_id_url.format(group_id), auth=HTTPBasicAuth(username, password), headers=headers, verify=False)
    return r.json()['IdentityGroup']


def get_group_detail_by_name(group_name):
    r = requests.get(url_prefix + get_by_name_url.format(group_name), auth=HTTPBasicAuth(username, password), headers=headers, verify=False)
    return r.json()['IdentityGroup']


if __name__ == "__main__":
    # print(get_all_user())
    # print(get_group_detail('a1740510-8c01-11e6-996c-525400b48521'))
    print(get_group_detail_by_name('Employee'))